package com.nbot.server.job;

import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;
import com.nbot.server.domain.Response;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.stereotype.Component;

/**
 * 用于测试计划任务
 */
@Component
public class WelcomeJob implements Job {
    private static final Log LOGGER = LogFactory.get();
    @Autowired
    SimpMessagingTemplate template;

    @Override
    public void execute(JobExecutionContext arg0) throws JobExecutionException {
        template.convertAndSend("/topic/getResponse", new Response("这是一个任务计划，使用了websocket和quzrtz技术，可以在计划列表中取消!"));
        LOGGER.info("WelcomeJob");

    }

}